package com.lhn.dao;

import com.lhn.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author lhn
 * @date 2024-08-19 18:47
 */
@Repository
public interface AccountDao {

    @Insert("insert into tbl_account(name,money) Values(#{name},#{money})")
    void save(Account account);

    @Delete("DELETE FROM tbl_account where id = #{id}")
    void delete(Integer id);

    @Update("UPDATE tbl_account set name = #{name}, money = #{money} where id = #{id}")
    void update(Account account);

    @Select("SELECT * FROM tbl_account")
    List<Account> findAll();

    @Select("SELECT * FROM tbl_account where id = #{id}")
    Account findById(Integer id);
}
